<?php

namespace App\Http\Middleware;

use Closure;
use Illuminate\Support\Facades\DB;

class Article
{
    /**
     * Handle an incoming request.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  \Closure  $next
     * @return mixed
     */
    public function handle($request, Closure $next)
    {
        $input= $request->input();
        $article_lists = Db::table('article')->where(['id','=',$input['article_id']])->first();
        if(empty($article_lists))return request()->json(['message'=>'article_id非法文章id','code'=>'-1']);


        return $next($request);
    }
}
